home *** CD-ROM | disk | FTP | other *** search
/ United Public Domain Gold 2 / United Public Domain Gold 2.iso / utilities / pu168a.dms / pu168a.adf / Scripts / tutorial1.art < prev    next >
Text File  |  1991-10-25  |  4KB  |  125 lines

  1. !---------------------------------------------------------------
  2. !
  3. ! Tutorial1 - This script creates a minimal scene
  4. !
  5. ! Concepts include :
  6. !
  7. !  o Using the print statement ( ? <msg> ) to provide
  8. !    user-visible messages on the MessageWindow.
  9. !
  10. !  o Declaring RGB colors.
  11. !
  12. !  o Declaring PHONG surfaces
  13. !
  14. !  o Declaring a SPHERE
  15. !
  16. !  o Setting up a checkerboard ground pattern
  17. !
  18. !  o Camera placement
  19. !
  20. !  o Using ambient and star light sources
  21. !
  22. !---------------------------------------------------------------
  23.  
  24. ! Starting a script with a print statement that gives a quick
  25. ! description of the scene rendered by a script is a good idea.
  26. ! Be sure that each string to be printed starts and ends with
  27. ! double quote characters.  A new line on the message window
  28. ! is started with the newline sequence, \n (backslash n).
  29. ! Individual strings are seperated by commas.
  30.  
  31. ? "TUTORIAL1 - This script defines a scene with a single\n",
  32.   "sphere hovering over a checkerboard.\n";
  33.  
  34. ! The camera will be positioned over the negative y axis looking
  35. ! at a point over the origin where our sphere will be
  36. ! positioned.
  37.  
  38. CAMERA'POS = [0,-1300,400];
  39. CAMERA'TARGET = [0,0,300];
  40.  
  41.  
  42. ! Define the color of the sphere
  43.  
  44. SPHERE_COLOR : COLOR ( RGB, [0.8,0.4,0] );  ! Lt orange
  45.  
  46. ! Define the colors of the checker board
  47.  
  48. BLUE : COLOR ( RGB, [0,0,1] );
  49. YELLOW : COLOR ( RGB, [1,1,0] );
  50.  
  51.  
  52. ! Define the surface of the sphere.  We will use a phong
  53. ! surface. We want to be illuminated by ambient as well as
  54. ! diffuse light plus a specular hilite.  The sphere will also
  55. ! have a bit of mirror reflection.
  56.  
  57. !                ka  kd  ks   n   km  kr  ir  kb  flags
  58. SPHERE_SURF :
  59.   SURFACE(PHONG, 1.0,1.0,0.5,50.0,0.3,0.0,0.0,0.0,0 );
  60.  
  61. ! The ground will be a matte surface, no specular hilites or
  62. ! mirror reflections.
  63.  
  64. !                ka  kd  ks  n   km  kr  ir  kb  flags
  65. MATTE :
  66.   SURFACE(PHONG, 1.0,1.0,0.0,0.0,0.0,0.0,0.0,0.0,0 );
  67.  
  68.  
  69. ! Now we need to create our sphere.  Let's have it hovering over
  70. ! the world coordinate origin at a height of 300 units.  Its
  71. ! radius will be 200 units.
  72.  
  73. !         center  radius   color       surface
  74.  
  75. SPHERE( [0,0,300], 200, SPHERE_COLOR, SPHERE_SURF );
  76.  
  77.  
  78. ! Specify the ambient light.  This will provide illumination for
  79. ! the areas that are shadows from the star light source.
  80. ! Positioning of ambient lights is reserved for future
  81. ! expansion.  For now, set position to [0,0,0].  The intensity
  82. ! of ambient lights should range from [0,0,0] to [1,1,1].  We
  83. ! will use a muted white light. The ambient direction is UP, but
  84. ! since K1 and K2 are zero this light is non-directional making
  85. ! direction a place holder.  UP is toward the positive z-axis.
  86.  
  87. !        always 0's  color      direction k1(base) k2(range)
  88.  
  89. AMBIENT( [0,0,0], [0.6,0.6,0.6], [0,0,1],    0,       0 );
  90.  
  91.  
  92. ! Specify the STAR light.  Position it above, behind, and to the
  93. ! right of the camera.  Since the light of a star doesn't
  94. ! diminish with distance, good light values range from [0,0,0]
  95. ! to [1,1,1].  Make a slightly yellowish star.
  96.  
  97. !       position          color   radius
  98.  
  99. STAR( [5000,-5000,4000], [1,1,.9], 300 );
  100.  
  101.  
  102. ! Create the checkerboard.  This will be at elevation 0 (on z
  103. ! axis).  Checkerboard squares will be 300 x 300.
  104.  
  105. !          type      ht  size color surf   color   surf
  106.  
  107. GROUND( CHECKERBOARD, 0, 300, BLUE, MATTE, YELLOW, MATTE );
  108.  
  109.  
  110. ! Set the background color to a dark, muddy red.
  111.  
  112. !           type   rgb color value
  113.  
  114. BACKGROUND( PLAIN, [0.2,0.05,0.05] );
  115.  
  116.  
  117. ! The scene has now been constructed, render it!
  118.  
  119. RENDER;
  120.  
  121.  
  122. ! All scripts must terminate with an END.
  123.  
  124. END
  125.